<?php 
session_start();
require_once('classes/blogContent.php');
$needLogin = true; 
$userFail ="";
if (isset($_GET['blokker'])) {
	$user->blockUser($db,$_GET['id']);
}
else if(isset($_GET['avblokker'])){
	$user->unblockUser($db,$_GET['id']);
}
if(isset($_GET['changetype'])){
	$user->changeType($db,$_GET['id']);
}
?>
<!DOCTYPE html>
<html lang="en" >
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"> </script>
<script type="text/javascript">
$(document).ready(function() {
	$('.reg_btn').click(function() {
		$('#content').html("<h2>Registrer deg!</h2><form id='registrering' method='post' action='index.php' enctype='multipart/form-data'><fieldset><legend>Din brukerinformasjon</legend><ol><li><label for='uname'>Brukernavn</label><input type='text' name='uname' title='Ditt brukernavn' placeholder='Velg et brukernavn' required autofocus /></li><li><label for='pwd'>Passord</label><input type='password' name='pwd' title='Ditt passord' placeholder='Ditt passord' required /></li><li><label for='email'>E-post</label><input type='email' name='email' placeholder='eksempel@eebs.no' required /></li><input type='hidden' name='MAX_FILE_SIZE' value='6000000' /><li><label for='image'>Bilde</label><input type='file' name='image' placeholder='velg et bilde' /></li></ol></fieldset><fieldset><button type=submit>Registrer deg!</button></fieldset></form>");
	});
});

</script>
<meta charset="utf-8">
<title>EEBS</title>
<!--<link href="style.css" rel="stylesheet" /> -->
<link href="<?php echo $user->getStyle($db) ?>" rel="stylesheet" />
</head> 
<body>
<div id="wrapper">
	<header> 
		<h1>Enda et bullshit system</h1> 
		<a href="./" class="left image_button" ><img src="images/home.png" alt="Hjem" /></a> 		
	</header>
	
	<div id="content-wrap">
	<div id="sidebar">	
		<h2 style="margin-top: 0;">Brukerpanel</h2>
		<?php 
			if($user->loggedOn()) { echo "Du er logget inn som ".$user->getName(); }
			$user->showImage($db);
			echo $userFail;
			$user->getLoginForm();
			
			if($user->loggedOn()) { ?>
		<h2>Hallais</h2>
		<?php 
		echo $user->menu($db);
		} ?>
		<h2>Mest leste innlegg</h2>
		<?php $blogcontent->mestLesteInnlegg($db); ?>
		<h2>Mest kommenterte innlegg</h2>
		<?php $blogcontent->mestKommenterteInnlegg($db); ?>
		<?php if($user->LoggedOn()) { ?>
		<h2>Brukere ved EEBS</h2>
		<?php $user->listBlogUsers($db); }?>
	</div>
	
	
	<div id="content">
		<table style="text-align:center;">
        <tr><th>Username</th><th>E-mail</th><th>Type</th><th>Upassende innlegg</th><th>Blokkert</th>
        <?php $user->listUsers($db); ?>
        </table>
	</div>
	</div>
	<footer>
		<p>Glenn, Torstein, Arve og Marius</p>
	</footer>
</div>
</body>
</html>